/*
 * UMediaType.h
 *
 *  Created on: 2016年1月12日
 *      Author: terry
 */

#ifndef UMEDIATYPE_H_
#define UMEDIATYPE_H_

#include "BasicType.h"


#ifndef MKTAG
#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
#endif //MKTAG


enum UMediaType
{
    UMEDIA_TYPE_NONE  = -1,
    UMEDIA_TYPE_VIDEO = 0,
    UMEDIA_TYPE_AUDIO,
	UMEDIA_TYPE_DATA,
	UMEDIA_TYPE_SUBTITLE,
	//UMEDIA_TYPE_POSITION
};


enum UMediaState
{
    UMEDIA_STATE_STOPPED = 0,
    UMEDIA_STATE_PAUSED,
    UMEDIA_STATE_PLAYING,
	UMEDIA_STATE_OPEN,
	UMEDIA_STATE_CLOSED
};


enum UMediaCodec
{
    UMEDIA_CODEC_NONE = 0,

    UMEDIA_CODEC_MPEG2 = 2,
	UMEDIA_CODEC_MJPEG = 7,
    UMEDIA_CODEC_MPEG4 = 13,

    UMEDIA_CODEC_H264 = 28,
    UMEDIA_CODEC_VP8  = 141,

    UMEDIA_CODEC_THEORA=31,
    UMEDIA_CODEC_HEVC = 174,

    UMEDIA_CODEC_G711U = 65542,
    UMEDIA_CODEC_G711A,

    UMEDIA_CODEC_G722 = 69660,
    UMEDIA_CODEC_G723 = 86069,
    UMEDIA_CODEC_G729 = 86070,
    UMEDIA_CODEC_G726 = 69643,
    UMEDIA_CODEC_MP2  = 0x15000,

    UMEDIA_CODEC_MP3 = 0x15001,
    UMEDIA_CODEC_AAC = 0x15002,
    UMEDIA_CODEC_AC3 = 0x15003,
    UMEDIA_CODEC_VORBIS = 0x15005,
    UMEDIA_CODEC_SPEEX = 0x15024,
	UMEDIA_CODEC_OPUS = 0x1503d,

    UMEDIA_CODEC_HK = MKTAG('I', 'M', 'K', 'H'),	/// 海康私有流.
    UMEDIA_CODEC_DHAV = MKTAG('D', 'H', 'A', 'V'),   /// 大华私有流.
    UMEDIA_CODEC_PS = MKTAG('M', 'P', '2', 'P'), /// PS stream
    UMEDIA_CODEC_TS = MKTAG('M', 'P', '2', 'T'),

    UMEDIA_CODEC_RAW = 0x10101010,

	UMEDIA_CODEC_SRT = 0x17008,

};


enum UMediaFlag
{
    UMEDIA_FLAG_KEY = 0x01
};


enum UMediaConst
{
	UMEDIA_MAX_ID   = 128,
	UMEDIA_MAX_NAME = 260,
	UMEDIA_MAX_PATH = 260,
	UMEDIA_MAX_DESC = 512
};


/// 媒体包.
struct UPacket
{
    int type;       ///
    uint8_t* data;  /// 数据指针.
    int size;       /// 数据长度.
    int64_t pts;    /// 时间戳.
    int duration;   /// 时长.
    int flags;      /// 标识.
};


/// forward type
struct AVFrame;
struct AVPacket;







#endif /* UMEDIATYPE_H_ */
